home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6132 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.connect.net!usenet
  2. From: tomw@intelligraphics.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Memory allocation.
  5. Date: 11 Feb 1996 22:50:43 GMT
  6. Organization: Connection Technologies
  7. Message-ID: <4flrs3$a9m@dallas1.connect.net>
  8. References: <1996Feb10.161530.26449@wisipc.weizmann.ac.il>
  9. Reply-To: tomw@intelligraphics.com
  10. NNTP-Posting-Host: igxtest.intelligraphics.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <1996Feb10.161530.26449@wisipc.weizmann.ac.il>, Kajdan Dimitry <cerlpvk> writes:
  14. >I'm a starter so the question may seem stupid.
  15. >
  16. >Would someone explain why this program works?
  17.  
  18. Pure luck.  It just so happens that the stack hasn't been overwritten
  19. with anything else.  If you were to call other functions, that stack space
  20. would get trashed and the cout<<x[2]<<endl would no longer print the
  21. expected answer.
  22.  
  23. +---------------------------------------------------------------------------+
  24. + Tom Wheeler                          | Member NRA, NMRA                   +
  25. + tomw@intelligraphics.com             | OS/2 user, C++ programmer          +
  26. + ------------------------------------------------------------------------- +
  27. + Postmodernism is the refusal to think.  Deconstructionism is the refusal  +
  28. + to believe that anyone else can either.                                   +
  29. +---------------------------------------------------------------------------+
  30. + Use or reproduction of this document or the author's email address for    +
  31. + commercial purposes without the author's permission is prohibited.        +
  32. +---------------------------------------------------------------------------+
  33.  
  34.